package faw.car.ccentersdk.prop;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.Arrays;

/**
 * @Author zhuima
 */
public class HQActionConfig implements Parcelable {

    private String actionName;
    private boolean isSupport;
    private HQParamConfig[] paramConfigs;


    public String getActionName() {
        return actionName;
    }

    public void setActionName(String actionName) {
        this.actionName = actionName;
    }

    public boolean isSupport() {
        return isSupport;
    }

    public void setSupport(boolean support) {
        isSupport = support;
    }

    public HQParamConfig[] getParamConfigs() {
        return paramConfigs;
    }

    public void setParamConfigs(HQParamConfig[] paramConfigs) {
        this.paramConfigs = paramConfigs;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.actionName);
        dest.writeByte(this.isSupport ? (byte) 1 : (byte) 0);
        dest.writeTypedArray(this.paramConfigs, flags);
    }

    public HQActionConfig() {
    }

    protected HQActionConfig(Parcel in) {
        this.actionName = in.readString();
        this.isSupport = in.readByte() != 0;
        this.paramConfigs = in.createTypedArray(HQParamConfig.CREATOR);
    }

    public static final Creator<HQActionConfig> CREATOR = new Creator<HQActionConfig>() {
        @Override
        public HQActionConfig createFromParcel(Parcel source) {
            return new HQActionConfig(source);
        }

        @Override
        public HQActionConfig[] newArray(int size) {
            return new HQActionConfig[size];
        }
    };

    @Override
    public String toString() {
        return "HQActionConfig{" +
                "actionName='" + actionName + '\'' +
                ", isSupport=" + isSupport +
                ", paramConfigs=" + Arrays.toString(paramConfigs) +
                '}';
    }
}
